package com.onegene.pdf.component.factory;

import com.onegene.pdf.component.AbstractReportBuilder;
import com.onegene.pdf.component.report.cancer.CancerTenReportBuilder;
import com.onegene.pdf.component.report.colon.ColonReportBuilder;
import com.onegene.pdf.component.report.drug.DrugReportBuilder;
import com.onegene.pdf.component.report.gene.GenoReportBuilder;
import com.onegene.pdf.util.Precondition;

/**
 * @author: laoliangliang
 * @description:
 * @create: 2020/7/3 16:00
 **/
public class ReportFactory {

    public static AbstractReportBuilder create(ReportBuilderContext builderContext) {
        AbstractReportBuilder builder = null;
        Integer type = builderContext.getType();
        // 构建PDF
        if (type == 1) {
            builder = new DrugReportBuilder(builderContext);
        } else if (type == 0) {
            builder = new GenoReportBuilder(builderContext);
        } else if (type == 2) {
            builder = new CancerTenReportBuilder(builderContext);
        } else if (type == 3) {
            builder = new ColonReportBuilder(builderContext);
        } else {
            Precondition.throwDataException("不存在该type类型");
        }
        return builder;
    }
}
